<!--用户后台侧边栏-->
#if(type=='set')
<div class="cd-sidebar">
  <ul class="cd-sidebar__list">
    <li class="cd-sidebar__heading">个人设置</li>
    <li class="cd-sidebar__item ">
      <a href="/user/setting/info">个人信息</a>
    </li>
    <li class="cd-sidebar__item ">
      <a href="/user/setting/security">安全设置</a>
    </li>
  </ul>
</div>
#else
<div class="sidenav">
  <!--根据session确定用户类型-->
  #if(role != null && role > 1)
  <ul class="list-group">
    <li class="list-group-heading">我的教学</li>
    <li class="list-group-item ">
      <a href="/user/teacher/myTeach">在教课程</a>
    </li>
    <!--<li class="list-group-item ">-->
      <!--<a href="#">教学课表</a>-->
    <!--</li>-->
    <li class="list-group-item ">
      <a href="/user/teacher/announcement">发布公告</a>
    </li>
    <li class="list-group-item ">
      <a href="/user/teacher/asks">学生问题</a>
    </li>
    <!--<li class="list-group-item ">-->
      <!--<a href="/user/teacher/homework">作业批阅</a>-->
    <!--</li>-->
    <li class="list-group-item ">
      <a href="/user/teacher/exam">试卷批阅</a>
    </li>
    <!--<li class="list-group-item ">-->
      <!--<a href="#">教学资料库</a>-->
    <!--</li>-->
  </ul>
  #end
  <ul class="list-group">
    <li class="list-group-heading">我的学习</li>
    <li class="list-group-item">
      <a href="/user/learn">我的课程</a>
    </li>
    <!--<li class="list-group-item ">-->
      <!--<a href="/user/work">我的作业</a>-->
    <!--</li>-->
    <li class="list-group-item ">
      <a href="/user/exam">我的考试</a>
    </li>
    <li class="list-group-item ">
      <a href="/user/note">我的笔记</a>
    </li>
    <li class="list-group-item ">
      <a href="/user/asks">我的提问</a>
    </li>
    <li class="list-group-item ">
      <a href="/user/comment">我的评价</a>
    </li>
  </ul>
</div>
#end
<script>
  /**
   * 自动选中侧边菜单 传入菜单名
   */
  (function (document, name) {
    var lis = document.querySelectorAll("li[class*='item']");
    for (var i = 0; i < lis.length; i++) {
      var tag = lis[i];
      if (tag.classList.contains("active")) {
        tag.classList.remove("active");
      } else if(tag.querySelector('a').innerText === name) {
        tag.classList.add("active");
      }
    }
  })(document, '${name}');
</script>
